package com.woniu.controller;

import com.woniu.entity.SurgeryItem;
import com.woniu.entity.Ward;
import com.woniu.service.WardService;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/ward")
public class WardController {
    @Resource
    private WardService wardService;

    @GetMapping("/findAll")
    public ResponseUtil selectAll(@RequestParam Integer pageNum, @RequestParam Integer pageSize){
        return wardService.findAll(pageNum,pageSize);
    }
    @GetMapping("/find")
    public ResponseUtil selectByCondition(@RequestParam(required = false) String roomName,@RequestParam Integer pageNum,@RequestParam Integer pageSize){
        return wardService.selectByCondition(roomName,pageNum,pageSize);
    }
    @PostMapping("/del")
    public ResponseUtil updateWard(Integer id){
        return wardService.updateWard(id);
    }
    @PostMapping("/insert")
    public ResponseUtil insertSelective(@RequestBody Ward record){
        return wardService.insertSelective(record);
    }
    @PostMapping("/update")
    public ResponseUtil updateByPrimaryKeySelective(@RequestBody Ward record){
        return wardService.updateByPrimaryKeySelective(record);
    }
}
